package com.fyt.reachgo.controller;

import com.fyt.reachgo.domain.Result;
import com.fyt.reachgo.service.TravelRequestService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/travelReq")
@RequiredArgsConstructor
public class TravelReqController {

    private final TravelRequestService travelRequestService;

    /**
     * 获得用户游记
     * @return
     */
    @RequestMapping("/getTravelReqByUser")
    public Result getTravelReq(){
        return travelRequestService.getTravelReqByUser();
    }

    /**
     * 获取用户排行榜
     */
    @RequestMapping("/getTravelReqByUsers")
    public Result getTravelReqByUsers(){
        return travelRequestService.getTravelReqByUsers();
    }

    @RequestMapping("/getTravelReqByUserId/{userId}")
    public Result getTravelReqByUserId(@PathVariable("userId") Long userId){
        return travelRequestService.getTravelReqByUserId(userId);
    }
}
